package com.glory.brepda.adapter;

import android.widget.CheckBox;
import androidx.annotation.Nullable;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.glory.brepda.R;
import com.glory.brepda.activity.mfg.BreHoldsEntity;
import java.util.List;

public class BreHoldFlowAdapter extends BaseQuickAdapter<BreHoldsEntity.HoldEntity, BaseViewHolder> {

    public BreHoldFlowAdapter(@Nullable List<BreHoldsEntity.HoldEntity> data) {
        super(R.layout.item_flow_info,data);
    }

    @Override
    protected void convert(BaseViewHolder helper, BreHoldsEntity.HoldEntity item) {
        CheckBox checkBox = helper.getView(R.id.cbCheck);
        checkBox.setChecked(item.isChecked());
        helper.setText(R.id.list_tv1,item.getHoldTime());
        helper.setText(R.id.list_tv2,item.getHoldReson());
        checkBox.setOnClickListener(view -> {
            getData().get(helper.getAdapterPosition()).setChecked(checkBox.isChecked());
            notifyItemChanged(helper.getAdapterPosition());
        });
    }
}
